Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
Property body[41] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"

My react native project worked fine yesterday. But this morning, after I tried to run it again, it gave me the following error:

error node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js: Property body[41] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression". Run CLI with --verbose flag for more details.
TypeError: Property body[41] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"

I'm not sure what it means, though. How can I solve this issue?

over 4 years ago · Santiago Trujillo
6 answers
Answer question

0

Apparently, it may be a problem with the babel. Copy the folder @babel (specifically @babel/core) that is in the node_modules of a working project into the new project and it runs without problems.

It may be due to an update they did a couple of hours ago.

You can also remove the current @babel/core from the package.json and install this version npm install --save-dev @babel/core@latest.

Or use this:
@babel file: https://drive.google.com/file/d/1-z_4H_z4x075unZqZD41WYUwY_hsrKox/view.

Or replace the following codes in your package.json file then npm install.

"@babel/core": "~7.14.0",
"@babel/compat-data": "~7.14.0",
"@babel/generator": "~7.14.0",
"@babel/helper-compilation-targets": "~7.14.0",
"@babel/helper-create-class-features-plugin": "~7.14.0",
"@babel/helper-create-regexp-features-plugin": "~7.14.0",
"@babel/helper-member-expression-to-functions": "~7.14.0",
"@babel/helper-module-transforms": "~7.14.0",
"@babel/helper-replace-supers": "~7.14.0",
"@babel/plugin-transform-react-display-name": "~7.14.0",
"@babel/plugin-transform-runtime": "~7.14.0",
"@babel/types": "~7.14.0",
over 4 years ago · Santiago Trujillo Report

0

copy @babel from some other project and paste in node_modules is the only solution for now

over 4 years ago · Santiago Trujillo Report

0

This appears to be a bug with 7.15.0 of Babel which they are making a E2E React native regression test for.

Updated answer

A few hours ago they have released the fix. It is due to a change to @babel/plugin-transform-react-display-name which has been reverted in 7.15.1. With that fix, you should be able to remove the extra entries in the package.json from my original answer and instead do the following.

npm install --save-dev @babel/core@latest

Original answer

Unfortunately, simply downgrading @babel/core to 7.14 will not be enough because it seems to pull the latest dependencies for the other components. Instead what you need to do is lock down @babel/core and any other Babel component you are working that is coercing @babel/types to go to 7.15.0

Here's the relevant section I had in my package.json

"@babel/core": "~7.14.0",
"@babel/compat-data": "~7.14.0",
"@babel/generator": "~7.14.0",
"@babel/helper-compilation-targets": "~7.14.0",
"@babel/helper-create-class-features-plugin": "~7.14.0",
"@babel/helper-create-regexp-features-plugin": "~7.14.0",
"@babel/helper-member-expression-to-functions": "~7.14.0",
"@babel/helper-module-transforms": "~7.14.0",
"@babel/helper-replace-supers": "~7.14.0",
"@babel/plugin-transform-react-display-name": "~7.14.0",
"@babel/plugin-transform-runtime": "~7.14.0",
"@babel/types": "~7.14.0",

Just replace all of that and perform an npm install and let it try to resolve and test your scenario again. If it still fails just look at package-lock.json and locate 7.15.0 and adjust the dependency accordingly

With this approach you don't need to "recover" from a zip file.

over 4 years ago · Santiago Trujillo Report

0

Pin @babel/plugin-transform-react-display-name to 7.14.5.

You can do it via adding this into your package.json if your package manager support resolutions.

  "resolutions": {
    "@babel/plugin-transform-react-display-name": "7.14.5"
  }

Thank to facebook/react-native#31960

over 4 years ago · Santiago Trujillo Report

0

the problem is due to a babel update that affected the RN project. copy @babel from some other project and paste in node_modules or Download the @babel folder from here and replace the existing folder in the node_modules.Babel Download

And run

npm start --reset-cache
over 4 years ago · Santiago Trujillo Report

0

I've had this come up when I change git branches and need to do a yarn install. I like the comment to change the bable version since I'm also on 7.15 and I'll try this the next time it occurs...

To get around this I have successfully:

  1. Stopped metro
  2. ran a cleanup script (included below)
  3. removed/uninstall app from device/simulator
  4. started metro
  5. installed app
  6. sometimes I still get the error and do 1-5 again and it works.

my cleanup script

#!/bin/bash

echo "clean'n android"
cd ./android && ./gradlew clean
cd ..

rm -rf ./node_modules
yarn cache clean
rm ./yarn.lock

rm -rf $TMPDIR/react-*
rm -rf $TMPDIR/metro-builder-cache-*

yarn install

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!